package edu.gdut.tiantian.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.gdut.tiantian.dao.CartDao;
import edu.gdut.tiantian.entity.CartItem;
import edu.gdut.tiantian.service.ICartService;
@Service
public class CartService implements ICartService {
	
	@Autowired
	private CartDao cartDao;

	@Override
	public void addProductToCart(String userId, String productId, int buyNum) {
			cartDao.addProductToCart(userId, productId, buyNum);
	}

	@Override
	public void clearCart(String userId) {
		cartDao.clearCart(userId);
	}

	@Override
	public void delCartItem(int cartItemId) {
		cartDao.delCartItem(cartItemId);
	}

	@Override
	public List<CartItem> getCart(String userId) {
		return cartDao.getCart(userId);
	}

	@Override
	public CartItem findById(String userId, String productId) {
		return cartDao.findById(userId, productId);
	}

	@Override
	public void updateCateItem(String userId, String productId, int buyNum) {
		cartDao.updateCateItem(userId, productId, buyNum);
	}

}
